<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>闲言轻博客</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    {{template "/comn/link.html"}}
</head>
<body class="lay-blog">
{{template "/comn/header.html" .}}
<div class="container-wrap">
    <div class="container">
        <div class="contar-wrap">
                <div class="layadmin-user-login-box layadmin-user-login-body layui-form">
                    <div class="layui-form-item">
                        <label class="layadmin-user-login-icon layui-icon layui-icon-username" for="LAY-user-login-username"></label>
                        <input type="text" name="name" id="LAY-user-login-username" lay-verify="required" placeholder="用户名" class="layui-input">
                    </div>
                    <div class="layui-form-item">
                        <label class="layadmin-user-login-icon layui-icon layui-icon-username" for="LAY-user-login-username"></label>
                        <input type="text" name="email" id="LAY-user-login-username" lay-verify="required" placeholder="邮箱" class="layui-input">
                    </div>
                    <div class="layui-form-item">
                        <label class="layadmin-user-login-icon layui-icon layui-icon-password" for="LAY-user-login-password"></label>
                        <input type="password" name="password" id="LAY-user-login-password" lay-verify="required" placeholder="密码" class="layui-input">
                    </div>
                    <div class="layui-form-item">
                        <label class="layadmin-user-login-icon layui-icon layui-icon-password" for="LAY-user-login-password"></label>
                        <input type="password" name="password1" id="LAY-user-login-password" lay-verify="required" placeholder="确认密码" class="layui-input">
                    </div>
                    <div class="layui-form-item">
                        <button class="layui-btn layui-btn-fluid" lay-submit lay-filter="LAY-user-login-submit">注册</button>
                    </div>
                </div>
        </div>
    </div>
</div>
{{template "comn/footer.html"}}
<script>
    layui.use(['form', 'jquery'], function(){
        var $ = layui.$
            ,form = layui.form
            ,router = layui.router();

        form.render();

        //提交
        form.on('submit(LAY-user-login-submit)', function(obj){

            $.post("/reg",obj.field,function (data) {
                if(data.code==0){
                    layer.msg('注册成功');
                    if(data.action){
                        setTimeout(function () {
                            window.location.href=data.action
                        },300)
                    }
                }else{
                    layer.msg('注册失败');
                }
            },"json").error(function () {
                layer.msg('网络延迟');
            })


        });


    });
</script>
</body>
</html>